﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.DataAccess;
using System.Collections.ObjectModel;
namespace SD.Business
{
    public static class TeamBus
    {
        public static bool AddTeam(Team newTeam)
        {
            bool result = TeamDao.AddTeam(newTeam);
            return result;
        }

        public static bool AmendTeam(Team newTeam)
        {
            bool result = TeamDao.AmendTeam(newTeam);
            return result;
        }

        public static bool SetStatusActive(int teamId)
        {
            bool result = TeamDao.ChangeTeamStatus(teamId, true);
            return result;
        }

        public static bool SetStatusInActive(int teamId)
        {
            bool result = TeamDao.ChangeTeamStatus(teamId, false);
            return result;
        }

        public static IQueryable<Team> ListTeam(bool status, Collection<string> filter)
        {
            IQueryable<Team> lstTeam = TeamDao.ListTeam(status, filter);
            return lstTeam;
        }

        public static IQueryable<Team> ListTeamByDepartment(bool status, Collection<string> filter, int departmentId)
        {
            IQueryable<Team> lstTeam = TeamDao.ListTeamByDepartment(status, filter, departmentId);
            return lstTeam;
        }

        public static Team GetTeam(int teamId)
        {
            Team newTeam = TeamDao.GetTeam(teamId);
            return newTeam;
        }

        public static Team GetTeamByName(string teamName)
        {
            Team newTeam = TeamDao.GetTeamByName(teamName);
            return newTeam;
        }

        public static bool CheckNameWithId(int teamId, string teamName)
        {
            bool result = TeamDao.CheckNameTeam(teamName, teamId);
            return result;
        }

        public static bool CheckName(string teamName)
        {
            bool result = TeamDao.CheckNameTeam(teamName);
            return result;
        }
    }
}